#include <stdio.h>
#include <string.h>
#include <stdlib.h> 

#define TAMANHO_BUFFER 10

char next(int ipos, char* cBuffer)
{
     return cBuffer[ipos];
}
int main(int argc, char **argv)
{   
    FILE *pArq1;

    char cBuffer1[TAMANHO_BUFFER];
    char cBuffer2[TAMANHO_BUFFER];
    pArq1 = fopen("teste1.txt","r");
    
    int iposIni = 0;
    int iposFim = TAMANHO_BUFFER - 1;

    if (pArq1 != NULL)
    {
         fgets(cBuffer1, TAMANHO_BUFFER, pArq1);
         while(strlen(cBuffer1) > 0)
         {
             printf("%c",next(iposIni,cBuffer1));
             iposIni++;
             if(!feof(pArq1)) break;
             if(iposIni = iposFim)
             {
                      fgets(cBuffer1, TAMANHO_BUFFER, pArq1);                    
                      iposIni = 0;
             }
         }                  
         fclose(pArq1);
    }
system("pause");
    return 0;
}
